export function numberToLabel(number: number) {
  let numberString = number.toString();
  if (number < 10000) {
    return numberString;
  }
  let label = '';
  //亿
  if (numberString.length > 8) {
    label = label.concat(numberString.substring(0, numberString.length - 8));
    label = label.concat('亿');
    //不再保留亿以上的数值
    numberString = numberString.substring(numberString.length - 8);
  }
  //万
  if (numberString.length > 4) {
    let isHeaderZero = true;
    for (let i = 0; i < numberString.length - 4; i++) {
      const tempNumberString = numberString.charAt(i);
      if (tempNumberString !== '0' || !isHeaderZero) {
        label = label.concat(tempNumberString);
        isHeaderZero = false;
      }
    }
    label = label.concat('万');
    //不再保留万以上的数值
    numberString = numberString.substring(numberString.length - 4);
  }
  //个
  let isHeaderZero = true;
  for (let i = 0; i < 4; i++) {
    const tempNumberString = numberString.charAt(i);
    if (tempNumberString !== '0' || !isHeaderZero) {
      label = label.concat(tempNumberString);
      isHeaderZero = false;
    }
  }

  return label;
}
